#ifndef PLAY_H
#define PLAY_H

#include <exception>
#include <string>
#include "sound.h"
#include <windows.h>
#include <MMSystem.h>
#include <string>
#include <thread>
class play_exception : std::exception
{
    std::string description;
public:
    play_exception(const std::string& description)
        : description(description)
    {}
    virtual char const* what() const throw()
    {
        return description.data();
    }
};

class play
{
//    LPSTR block;
//    DWORD blockSize;
    WAVEFORMATEX pwfx;
    HWAVEOUT phwo;
    WAVEHDR wHdr = {0};
public:
    play();
    play(const sound& s);
    BOOL writeOutAudioBlock(LPSTR block, DWORD size);
    BOOL closeOutAudioBlock();
    void reset();
    void set_sound(const sound& s);
    void pause();
    void restart();
    void unprepare();
};

#endif // PLAY_H
